

<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>控制面板主页</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
  <link rel="stylesheet" href="__PUBLIC__/layui/css/layui.css" media="all">
  <link rel="stylesheet" href="__PUBLIC__/style/admin.css" media="all">
</head>
<body>
  
  <div class="layui-fluid">
    <div class="layui-row layui-col-space15">
      <div class="layui-col-md8">
        <div class="layui-row layui-col-space15">
          <div class="layui-col-md12">
            <div class="layui-card">
              <div class="layui-card-header">数据概览</div>
              <div class="layui-card-body">
                <div class="layui-carousel layadmin-carousel layadmin-backlog">
                  <div carousel-item>
                    <ul class="layui-row layui-col-space10">                      
                      <li class="layui-col-xs4">
                        <a class="layadmin-backlog-body">
                          <h3>项目数量</h3>
                          <p><cite>{$count.project}</cite></p>
                        </a>
                      </li>
                      <li class="layui-col-xs4">
                        <a class="layadmin-backlog-body">
                          <h3>内容数量</h3>
                          <p><cite>{$count.data}</cite></p>
                        </a>
                      </li>
                      <li class="layui-col-xs4">
                        <a class="layadmin-backlog-body">
                          <h3>通知数量</h3>
                          <p><cite>{$count.notice}</cite></p>
                        </a>
                      </li>
                      <li class="layui-col-xs4">
                        <a class="layadmin-backlog-body">
                          <h3>用户数量</h3>
                          <p><cite>{$count.user}</cite></p>
                        </a>
                      </li>
                      <li class="layui-col-xs4">
                        <a class="layadmin-backlog-body">
                          <h3>模板数量</h3>
                          <p><cite>{$count.template}</cite></p>
                        </a>
                      </li>
                      <li class="layui-col-xs4">
                        <a class="layadmin-backlog-body">
                          <h3>载荷数量</h3>
                          <p><cite>{$count.payload}</cite></p>
                        </a>
                      </li>                      
                    </ul>
                  </div>
                </div>
              </div>
            </div>
          </div>
          <div class="layui-col-md12">
            <div class="layui-card">
              <div class="layui-card-header">最新通知</div>
              <div class="layui-card-body">
                <table class="layui-hide" id="notice-table"></table>
              </div>
            </div>
            
          </div>
        </div>
      </div>
      
      <div class="layui-col-md4">
        <div class="layui-card">
          <div class="layui-card-header">版本信息</div>
          <div class="layui-card-body layui-text">
            <table class="layui-table">
              <colgroup>
                <col width="100">
                <col>
              </colgroup>
              <tbody>
                <tr>
                  <td>系统名称</td>
                  <td>{$title}</td>
                </tr>
                <tr>
                  <td>版本号</td>
                  <td>{$version}</td>
                </tr>
                <tr>
                  <td>当前用户</td>
                  <td>{$user}</td>
                </tr>
                <tr>
                  <td>服务器</td>
                  <td>{$os}</td>
                </tr>
                <tr>
                  <td>PHP版本</td>
                  <td>{$php}</td>
                </tr>
              </tbody>
            </table>
          </div>
        </div>
        
        <div class="layui-card">
          <div class="layui-card-header">
            系统说明
          </div>
          <div class="layui-card-body layui-text layadmin-text">
            <p>本系统为高度模块化、自由化的远程探针取证系统。</p>
            <p></p>
            <p>模板：一个探针接口有且仅有一个模块模板，主要用于构建GET请求，将各载荷的执行数据作为参数提交给服务器，该接口一经定义就无需修改。</p>
            <p>载荷：是用户高度自定义的攻击模块，通过管理员账号可自行添加模块，模块需要定义为函数形式，并返回字符串类型的结果，模板会执行每个载荷的函数，并将结果依次回传到服务器。</p>
            <p>本系统采用两级用户系统：管理员能够修改系统配置、编辑用户、编辑模板；普通用户仅能操作项目相关功能，不同用户数据相互隔离。项目操作建议使用普通账号。</p>
            <p>—— <a href="#">Copyright© 2022-2024 {$title}。</a></p>
          </div>
        </div>
      </div>
      
    </div>
  </div>

  <script type="text/html" id="statusTpl">
    {{# if(d.readed == 1) { }}
    <button type="button" class="layui-btn layui-btn-xs layui-btn-disabled">已读</button>
    {{# } else { }}
    <button type="button" class="layui-btn layui-btn-xs layui-btn-primary layui-border-green" onclick="edit_notice('{{d.id}}',this)">未读</button>
    {{# } }}
  </script>

  <script src="__PUBLIC__/layui/layui.js?t=1"></script>  
  <script>
  layui.config({
    base: '__PUBLIC__/' //静态资源所在路径
  }).extend({
    index: 'lib/index' //主入口模块
  }).use(['index', 'console','table','util'],function(){
    var table = layui.table, util = layui.util;

    //动态加载荷列表
    table.render({
      elem: '#notice-table'
      ,url: "{:U('Ajax/ajax_notice_list')}"
      ,limit: 20 
      ,page: true
      ,cols: [[
        {field:'id', width:80, title: 'ID'}
        ,{field:'project',  title: '项目名称'}
        ,{field:'text',  title: '通知内容'}
        ,{field:'time', width:160, title: '创建时间', templet:
          function(d){ return util.timeAgo(d.time*1000, true);}
        }
        ,{field:'readed',  width:100, title: '状态', templet:'#statusTpl'}
      ]]
      ,cellExpandedMode:'tips'
      ,done: function(res, curr, count){
        currPage = curr;
      }
    });
  });

  function edit_notice(id,dom){
    layui.$.post("{:U('Ajax/ajax_notice_edit')}", JSON.stringify({"id":id}), function(d){
      if(d.code == 0){
        layui.$(dom).addClass("layui-btn-disabled");
      }else{
        layer.msg(d.msg);
      }
    });
  }
  </script>
</body>
</html>

